/*!
    \copyright  Copyright (c) 2005 - 2023 Qualcomm Technologies International, Ltd.
                All Rights Reserved.
                Qualcomm Technologies International, Ltd. Confidential and Proprietary.
    \version    
    \file       state_proxy_flags.h
    \addtogroup state_proxy
    @{
    \brief      Handle boolean state changes that are monitored by state proxy.
*/

#ifndef STATE_PROXY_FLAGS_H
#define STATE_PROXY_FLAGS_H

#include <marshal.h>

typedef struct state_proxy_msg_empty_payload
{
    state_proxy_event_type type;
} state_proxy_msg_empty_payload_t;

/*! \brief Get flags state for initial state message. */
void stateProxy_GetInitialFlags(void);

/*! \brief Set remote device flags to initial state. */
void stateProxy_SetRemoteInitialFlags(void);

/*! \brief Handle local flags event. 
    \param[in] marshal_type Marshalling type definition for the flags.
    \param[in] setting Boolean value to set the flag to.
    \param[in] ind Pointer to the message containing event.
    \param[in] ind_size Size of the event message in bytes.
 */
void stateProxy_FlagIndicationHandler(marshal_type_t marshal_type, bool setting,
                                             const void* ind, size_t ind_size);

/*! \brief Handle remote flags event. 
    \param[in] marshal_type Marshalling type definition for the flags.
    \param[in] setting Boolean value to set the flag to.
    \param[in] ind Pointer to the message containing event.
 */
void stateProxy_RemoteFlagIndicationHandler(marshal_type_t marshal_type, bool setting,
                                                   const void* ind);

/*! \brief Handle remote flag events generated by messages with no payload.
    \param[in] msg Pointer to message containing ID of remote flag event.
*/
void stateProxy_HandleMsgEmptyPayload(const state_proxy_msg_empty_payload_t* msg);

/*! \brief Helper function to update a flag state for a local or remote data set.
    \param[in] marshal_type Marshalling type definition for the flags.
    \param[in] setting Boolean value to set the flag to.
    \param[in] source Local or Remote state proxy data set.
*/
state_proxy_event_type stateProxy_UpdateFlag(marshal_type_t marshal_type, bool setting,
                                             state_proxy_source source);
#endif /* STATE_PROXY_FLAGS_H */

/*! @} */